import React, { useEffect } from 'react'
import ReactDOM from 'react-dom'

// export default function Test() {
//   return ReactDOM.createPortal(
//     <div>Test</div>,
//     document.getElementById('container')
//   )
// }
const xxx = document.createElement('div')
export default function Test() {
  useEffect(() => {
    document.getElementById('container').appendChild(xxx)
    return () => {
      document.getElementById('container').removeChild(xxx)
    }
  }, [])
  return ReactDOM.createPortal(<div>Test</div>, xxx)
}
